﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

using ImageRecognition2.CustomControls;

namespace LowLevelGraphics.ImageFormats
{
    /// <summary>
    /// Rtf
    /// </summary>
    public class Rtf : AbstractImageFormat, IImageFormat
    {
        /// <summary>
        /// returns Extension
        /// </summary>
        public override string Extension
        {
            get { return "rtf"; }
        }

        /// <summary>
        /// Creates the specified _s file name.
        /// </summary>
        /// <param name="_sFileName">Name of the _s file.</param>
        /// <returns></returns>
        public static UnsafeBitmap Create(string _sFileName)
        {
            PrintableRichTextBox richTextBox = new PrintableRichTextBox();
            richTextBox.LoadFile(_sFileName);

            Bitmap bitmap = new Bitmap(1024, 768);
            Graphics graphics = Graphics.FromImage(bitmap);
            richTextBox.Print(0, richTextBox.Text.Length, new PaintEventArgs(graphics, new Rectangle(0, 0, 1024, 768)));
            return new UnsafeBitmap(bitmap);
        }

        /// <summary>
        /// Save
        /// </summary>
        /// <param name="_sFileName"></param>
        /// <returns></returns>
        public override bool Save(string _sFileName)
        {
            throw new NotImplementedException();
        }
    }
}
